package com.jy.modules.cims.component.balance.servicefee.impl;

import java.math.BigDecimal;

import com.jy.modules.cims.component.balance.servicefee.BaseServiceFee;
import com.jy.modules.cims.data.common.dto.TCMmCostParamDTO;
import com.jy.modules.cims.data.common.dto.TCMmRaisePlanDTO;
import com.jy.modules.cims.data.dto.CreditDetailDto;
import com.jy.modules.cims.data.dto.LoanDetailDto;
/**
 * 
 * ClassName: Default 机构默认服务费 均是 :服务费=服务费率*基数，担保费=担保费率*基数 ，风险金 = 风险金率*基数
 * @Description: TODO
 * @author dell
 * @date 2016-4-7
 */
public class Default extends BaseServiceFee{

	public BigDecimal doServiceFee(CreditDetailDto creditDetailDto,
			TCMmCostParamDTO tcmmCostParamDto) {
		
		//获取服务费基数
		BigDecimal baseAmount = super.getBaseServiceFee(creditDetailDto, tcmmCostParamDto.getServiceFeeBase());
		//获取服务费率
		BigDecimal feeRate = tcmmCostParamDto.getServiceFeeRatio();
		feeRate = (feeRate == null ? BigDecimal.ZERO : feeRate);
		return baseAmount.multiply(feeRate);
	}

	public BigDecimal doGuaranteeFee(CreditDetailDto creditDetailDto,
			TCMmCostParamDTO tcmmCostParamDto) {
		//获取担保费基数
		BigDecimal baseAmount = super.getBaseBondFee(creditDetailDto, tcmmCostParamDto.getGuaranteeFeeBase());
		//获取担保费率
		BigDecimal bondRate = tcmmCostParamDto.getGuaranteeFeeRatio();
		bondRate = (bondRate == null ? BigDecimal.ZERO : bondRate);
		return baseAmount.multiply(bondRate);
	}

	public BigDecimal doRiskFee(CreditDetailDto creditDetailDto,
			TCMmCostParamDTO tcmmCostParamDto) {
		//风险金基数
		BigDecimal baseAmount = super.getBaseRiskFee(creditDetailDto, tcmmCostParamDto.getMarginBase());
		//风险金比例
		BigDecimal riskRate = tcmmCostParamDto.getMarginRatio();
		riskRate = (riskRate == null ? BigDecimal.ZERO : riskRate);
		return baseAmount.multiply(riskRate);
	}
	
	/**
	 * 贷款默认费用计算
	 * @author zhangmi
	 * @date 2016-8-16 下午4:33:29
	 * @see com.jy.modules.cims.component.balance.servicefee.BaseServiceFee#doServiceFee(com.jy.modules.cims.data.dto.LoanDetailDto, com.jy.modules.cims.data.common.dto.TCMmCostParamDTO, com.jy.modules.cims.data.common.dto.TCMmRaisePlanDTO)
	 */
	public BigDecimal doServiceFee(LoanDetailDto loanDetailDto,
			TCMmCostParamDTO tcmmCostParamDto, TCMmRaisePlanDTO tcmmRaisePlanDto) {
		
		//获取服务费基数
		BigDecimal baseAmount = super.getBaseServiceFee(loanDetailDto, tcmmCostParamDto.getServiceFeeBase());
		//获取服务费率
		BigDecimal feeRate = tcmmCostParamDto.getServiceFeeRatio();//服务费率
		feeRate = (feeRate == null ? BigDecimal.ZERO : feeRate);
		return baseAmount.multiply(feeRate);
	}

	public BigDecimal doGuaranteeFee(LoanDetailDto loanDetailDto,
			TCMmCostParamDTO tcmmCostParamDto, TCMmRaisePlanDTO tcmmRaisePlanDto) {
		//获取担保费基数
		BigDecimal baseAmount = super.getBaseBondFee(loanDetailDto, tcmmCostParamDto.getServiceFeeBase());
		//获取担保费率
		BigDecimal bondRate = tcmmCostParamDto.getGuaranteeFeeRatio();
		
		bondRate = (bondRate == null ? BigDecimal.ZERO : bondRate);
		return baseAmount.multiply(bondRate);
	}

	public BigDecimal doRiskFee(LoanDetailDto loanDetailDto,
			TCMmCostParamDTO tcmmCostParamDto, TCMmRaisePlanDTO tcmmRaisePlanDto) {
		//风险金基数
		BigDecimal baseAmount = super.getBaseRiskFee(loanDetailDto, tcmmCostParamDto.getServiceFeeBase());
		//风险金比例
		BigDecimal riskRate = tcmmCostParamDto.getMarginRatio();
		riskRate = (riskRate == null ? BigDecimal.ZERO : riskRate);
		return baseAmount.multiply(riskRate);
	}

}
